﻿using BLL.Interceptor;
using Castle.MicroKernel.Registration;
using Castle.Windsor;

namespace BLL.Installer
{
    public class BussinessInstaller : IWindsorInstaller
    {
        public void Install(IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.Register(
            AllTypes.
            FromThisAssembly().
            Where(p => p.Name == "LoginHelperImpl").
            WithService.DefaultInterfaces().LifestyleSingleton()
            );

            container.Register(
                AllTypes.
                FromThisAssembly().
                Where(p => p.Name.ToUpper().EndsWith("IMPL")).
                WithService.DefaultInterfaces().
                LifestyleTransient().
                Configure(c => c.Interceptors<ExceptionInterceptor>())
            );

        }

    }
}
